Further fixes for 32on64 bit kexec.
authorIan Campbell <ian.campbell@xensource.com>
Tue, 19 Jun 2007 14:03:55 +0000 (15:03 +0100)
committerIan Campbell <ian.campbell@xensource.com>
Tue, 19 Jun 2007 14:03:55 +0000 (15:03 +0100)
* switch to a suitable stack before jumping to compatibility mode.
* return the correct range for KEXEC_RANGE_MA_XEN.

Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
xen/arch/x86/x86_64/compat_kexec.S
xen/common/kexec.c

index 6edda35eefb99b58d8eb424b09107438cbbb35af..54b51437f858f6c51e679b8b163782b479957638 100644 (file)
@@ -73,6 +73,10 @@ ENTRY(compat_machine_kexec)
         RELOCATE_SYM(idle_pg_table,%rax)
         movq %rax, %cr3
 
+        /* Switch to identity mapped compatibility stack. */
+        RELOCATE_SYM(compat_stack,%rax)
+        movq %rax, %rsp
+
         /* Save xen_phys_start for 32 bit code. */
         movq xen_phys_start(%rip), %rbx
 
@@ -84,6 +88,14 @@ compatibility_mode_far:
         .long SYM_PHYS(compatibility_mode)
         .long __HYPERVISOR_CS32
 
+        /*
+         * We use 5 words of stack for the arguments passed to the kernel. The
+         * kernel only uses 1 word before switching to its own stack. Allocate
+         * 16 words to give "plenty" of room.
+         */
+        .fill 16,4,0
+compat_stack:
+
         .code32
 
 #undef RELOCATE_SYM
index 577492fec0214a4cdfa6926525a9766197162d7e..2437799d636cc51744dc2cbe53a172de906313e9 100644 (file)
@@ -169,7 +169,11 @@ static int kexec_get(reserve)(xen_kexec_range_t *range)
 
 static int kexec_get(xen)(xen_kexec_range_t *range)
 {
+#ifdef CONFIG_X86_64
+    range->start = xenheap_phys_start;
+#else
     range->start = virt_to_maddr(_start);
+#endif
     range->size = (unsigned long)xenheap_phys_end - (unsigned long)range->start;
     return 0;
 }